#include<bits/stdc++.h>
using namespace std;
int n,a[100010],q,sum,dp[100010];
int main(){
	freopen("pockets.in","r",stdin);
	freopen("pockets.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d",&a[i]);
		if(i!=1) sum+=a[i];
	}
	scanf("%d",&q);
	while(q--){
		memset(dp,0,sizeof(dp));
		scanf("%d",&a[n]);
		if(a[n]>1e6) printf("%d\n",a[n]+a[1]-sum);
		dp[n]=a[n];
		for(int i=n-1;i>=2;i--){
			int mx=-1e9,now=0,pos=i+1;
			for(int j=i+1;j<=n;j++){
				if(dp[j]-now>mx) mx=dp[j]-now,pos=j;
				now+=a[j];
			}
			for(int j=i;j<pos;j++)
				dp[i]+=a[j];
			dp[i]-=dp[pos];
		}
		printf("%d\n",a[1]-dp[2]);
	}
	return 0;
}
